package vista;
import java.awt.BorderLayout;
import javabean.JPanelImagen;
import java.awt.event.ActionListener;
import java.util.List;

import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;
import javax.swing.border.BevelBorder;

import bean.JTextFieldValidator;
import modeloDTO.Nivel;
import modeloDTO.Jugador;
import modeloDTO.Record;
import modeloDTO.Buscaminas;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VistaJugadorP extends javax.swing.JFrame {
	//private JPanelImagen panFondo;
	private JPanelImagen jPanelJugador;
	private JLabel lblTiempo;
	private JTextFieldValidator txtNickName;
	private JTextField txtTiempo;
	private JLabel jlblsegundos;
	private JTextField jtxtNombreNivel;
	private JLabel lblJugador;
	private JButton btnCerrar;
	private JButton btnGuardar;
	private JLabel lblNivel;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				VistaJugadorP inst = new VistaJugadorP();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public VistaJugadorP() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			GroupLayout thisLayout = new GroupLayout((JComponent)getContentPane());
			getContentPane().setLayout(thisLayout);
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("Buscaminas.-Registro de Record");
			{
				jPanelJugador = new JPanelImagen();
				jPanelJugador.setRutaImagen("/Ganador.jpg");
				GroupLayout jPanelJugadorLayout = new GroupLayout((JComponent)jPanelJugador);
				jPanelJugador.setLayout(jPanelJugadorLayout);
				{
					lblTiempo = new JLabel();
					lblTiempo.setText("Tiempo:");
				}
				{
					lblNivel = new JLabel();
					lblNivel.setText("Nivel:");
				}
				{
					btnGuardar = new JButton();
					btnGuardar.setText("Guardar");
				}
				{
					btnCerrar = new JButton();
					btnCerrar.setText("Cerrar");
				}
				{
					lblJugador = new JLabel();
					lblJugador.setText("NickName Jugador:");
				}
				{
					jlblsegundos = new JLabel();
					jlblsegundos.setText("seg");
				}
				{
					txtNickName = new JTextFieldValidator();
				}
				{
					jtxtNombreNivel = new JTextField();
					jtxtNombreNivel.setEditable(false);
				}
				{
					txtTiempo = new JTextField();
					txtTiempo.setEditable(false);
				}
					jPanelJugadorLayout.setHorizontalGroup(jPanelJugadorLayout.createSequentialGroup()
					.addGap(7)
					.addGroup(jPanelJugadorLayout.createParallelGroup()
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelJugadorLayout.createSequentialGroup()
					        .addComponent(lblNivel, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE)
					        .addGap(0, 93, Short.MAX_VALUE))
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelJugadorLayout.createSequentialGroup()
					        .addComponent(lblTiempo, GroupLayout.PREFERRED_SIZE, 104, GroupLayout.PREFERRED_SIZE)
					        .addGap(0, 36, Short.MAX_VALUE))
					    .addComponent(lblJugador, GroupLayout.Alignment.LEADING, 0, 140, Short.MAX_VALUE)
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelJugadorLayout.createSequentialGroup()
					        .addGap(38)
					        .addComponent(btnGuardar, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE)
					        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, Short.MAX_VALUE)))
					.addGroup(jPanelJugadorLayout.createParallelGroup()
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelJugadorLayout.createSequentialGroup()
					        .addComponent(txtNickName, GroupLayout.PREFERRED_SIZE, 91, GroupLayout.PREFERRED_SIZE)
					        .addGap(79))
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelJugadorLayout.createSequentialGroup()
					        .addComponent(jtxtNombreNivel, GroupLayout.PREFERRED_SIZE, 91, GroupLayout.PREFERRED_SIZE)
					        .addGap(79))
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelJugadorLayout.createSequentialGroup()
					        .addComponent(txtTiempo, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE)
					        .addGroup(jPanelJugadorLayout.createParallelGroup()
					            .addGroup(GroupLayout.Alignment.LEADING, jPanelJugadorLayout.createSequentialGroup()
					                .addComponent(jlblsegundos, GroupLayout.PREFERRED_SIZE, 54, GroupLayout.PREFERRED_SIZE)
					                .addGap(63))
					            .addGroup(GroupLayout.Alignment.LEADING, jPanelJugadorLayout.createSequentialGroup()
					                .addGap(22)
					                .addComponent(btnCerrar, GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE)))))
					.addContainerGap(21, 21));
					jPanelJugadorLayout.setVerticalGroup(jPanelJugadorLayout.createSequentialGroup()
					.addContainerGap(28, 28)
					.addGroup(jPanelJugadorLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(jtxtNombreNivel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblNivel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(18)
					.addGroup(jPanelJugadorLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(txtNickName, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblJugador, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
					.addGroup(jPanelJugadorLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(txtTiempo, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jlblsegundos, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblTiempo, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(23)
					.addGroup(jPanelJugadorLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(btnGuardar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 34, GroupLayout.PREFERRED_SIZE)
					    .addComponent(btnCerrar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 32, GroupLayout.PREFERRED_SIZE))
					.addContainerGap(43, 43));
			}
					thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
						.addContainerGap()
						.addComponent(jPanelJugador, GroupLayout.PREFERRED_SIZE, 224, GroupLayout.PREFERRED_SIZE)
						.addContainerGap(34, Short.MAX_VALUE));
					thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
						.addContainerGap(23, 23)
						.addComponent(jPanelJugador, 0, 338, Short.MAX_VALUE)
						.addContainerGap(29, 29));
			pack();
			setSize(400, 300);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public String getJtxtNombreNivel() {
		return jtxtNombreNivel.getText();
	}

	public void setJtxtNombreNivel(String jtxtNombreNivel) {
		this.jtxtNombreNivel.setText(jtxtNombreNivel);
	}

	public void addListener(ActionListener actionListener) {
		 this.txtNickName.addActionListener(actionListener);
		 this.txtTiempo.addActionListener(actionListener);
		 this.btnGuardar.addActionListener(actionListener);
		 this.btnCerrar.addActionListener(actionListener);
	 }
	
	 /*public void setCargarComboNivel(List<String> niveles) {
		 ComboBoxModel jComboNivelModel =
			 new DefaultComboBoxModel(niveles.toArray());
		 jComboNivel.setModel(jComboNivelModel);
	 }*/
	
	/* public String getJComboNivel() {
		 return jComboNivel.getSelectedItem().toString();
	 }*/
	
	/*public void setJComboNivel(JComboBox jComboNivel) { 
		this.jComboNivel.addItem(jComboNivel);
		 //jComboNivel.setBackground(new java.awt.Color(82,209,232));
		 jComboNivel.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
	}*/
	
	public String getNickName() {
		 return txtNickName.getText();
	 }
	public void setNickName(String name){
		 this.txtNickName.setText(name);
	 }
	
	public String getTiempo(){
		return txtTiempo.getText();
	}
	public void setTiempo(String tiempo){
		 this.txtTiempo.setText(tiempo);
	 }
	 
	 public void borrarDatos(){
		 txtNickName.setText("");
		 txtTiempo.setText("");
	 }
	 public void mostrarMensaje(String mensaje) {
		 JOptionPane.showMessageDialog(this, mensaje);
	 }

}
